import { defineConfig } from 'vitepress'
import { generateSidebar } from 'vitepress-sidebar'
export default defineConfig({
  title: 'VitePress_demo',
  description: 'A VitePress Site',
  vite: {
    plugins: [],
  },
  themeConfig: {
    // https://vitepress.dev/reference/default-theme-config
    search: {
      provider: 'local',
    },
    outline: {
      level: [2, 6],
      label: '导航',
    },
    nav: [
      { text: 'Home', link: '/' },
      { text: '其他', link: '/others/markdown-examples' },
      {
        text: 'vue相关',
        items: [
          {
            text: 'vue3',
            link: '/vue/pinia',
          },
          {
            text: 'nuxt3相关',
            link: '/nuxt3/安装',
          },
        ],
      },
      {
        text: 'react相关',
        items: [
          {
            text: 'react-native',
            link: '/react/react-native/native.md',
          },
          {
            text: 'nextjs',
            link: '/react/nextjs/nextjs.md',
          },
        ],
      },
    ],

    sidebar: generateSidebar([
      {
        documentRootPath: '/',
        scanStartPath: 'vue',
        resolvePath: '/vue/',
        // useTitleFromFileHeading: true,
        excludeFiles: [],
      },
      {
        documentRootPath: '/',
        scanStartPath: 'others',
        resolvePath: '/others/',
        useTitleFromFrontmatter: true,
        excludeFolders: ['secondLevel'],
      },
      {
        documentRootPath: '/',
        scanStartPath: 'nuxt3',
        resolvePath: '/nuxt3/',
        useTitleFromFrontmatter: true,
        excludeFolders: [],
      },
      //二级目录
      {
        scanStartPath: 'react/react-native',
        resolvePath: '/react/react-native/',
        // useTitleFromFrontmatter: true,
        excludeFolders: [],
      },
      {
        documentRootPath: '/',
        scanStartPath: 'react/nextjs',
        resolvePath: '/react/nextjs/',
        // useTitleFromFrontmatter: true,
        excludeFolders: [],
      },
    ]),
    // sidebar: {
    //   '/vue/': [
    //     {
    //       text: 'vue相关',
    //       items: [{ text: 'pinia', link: '/vue/pinia' }],
    //     },
    //   ],
    //   '/others/': [
    //     {
    //       text: 'Examples',
    //       items: [
    //         { text: 'Markdown Examples', link: '/others/markdown-examples' },
    //         { text: 'Runtime API Examples', link: '/others/api-examples' },
    //         { text: '本地文件', link: '/others/file' },
    //       ],
    //     },
    //   ],
    // },

    socialLinks: [
      { icon: 'github', link: 'https://github.com/vuejs/vitepress' },
    ],
  },
})
